import {contextBridge, ipcRenderer} from 'electron'
import type {ApiRequest} from './api'

contextBridge.exposeInMainWorld('env', {
  platform: process.platform
})

contextBridge.exposeInMainWorld('api', {
  request: <T = any>(req: ApiRequest): Promise<T> => ipcRenderer.invoke('api:request', req)
})